package com.cntaiping.ttnews.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.TextView;

import com.cntaiping.ttnews.R;

/**
 * Created by Administrator on 2016/7/21.
 */
public class NewsFragment  extends Fragment{
    private String title;
    public NewsFragment newInstacnce(String title){
        NewsFragment fragment = new NewsFragment();
        Bundle bd = new Bundle();
        bd.putString("title" , title);
        fragment.setArguments(bd);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(getArguments() != null){
            title = getArguments().getString("title");
        }
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        TextView tv = (TextView) view.findViewById(R.id.tv_title);
        tv.setText(title);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }
}
